import React from 'react';
import logoIcon from '../../../assets/logo.svg';
import cn from 'classnames';

interface LogoIconProps {
  className?: string;
  show: boolean;
  fillColor?: string;
  opacity?: number;
}

interface LogoProps {
  logoProps?: LogoIconProps;
  textProps?: LogoIconProps;
  className?: string;
  onClick?: () => void;
}

export const Logo: React.FC<LogoProps> = ({ className = '', onClick, logoProps, textProps }) => {
  const { show: showLogo = true, className: logoClassName } = logoProps || { show: true };
  const {
    show: showText = true,
    className: textClassName,
    fillColor,
    opacity,
  } = textProps || { show: true };

  return (
    <div
      className={`flex gap-1.5 items-center ${onClick ? 'cursor-pointer' : ''} ${className}`}
      onClick={onClick}
    >
      {showLogo && (
        <img
          src={logoIcon}
          className={cn(
            'object-contain shrink-0 self-stretch my-auto w-8 aspect-square',
            logoClassName,
          )}
          alt="Logo icon"
        />
      )}
      {showText && (
        <svg
          xmlns="http://www.w3.org/2000/svg"
          width="78"
          height="24"
          viewBox="0 0 78 24"
          fill="none"
          className={textClassName}
        >
          <path
            d="M44.3496 6.32715C44.5946 6.32715 44.8006 6.51146 44.8281 6.75488L45.5752 13.4053C45.6072 13.6902 45.9902 13.7595 46.1201 13.5039L49.6348 6.59082C49.7169 6.42929 49.8832 6.32715 50.0645 6.32715H52.249C52.6127 6.32715 52.8453 6.71539 52.6738 7.03613L47.0361 17.583C46.5349 18.5187 46.0586 19.3797 45.6074 20.165C45.173 20.9503 44.7304 21.6272 44.2793 22.1953C43.8281 22.7635 43.3596 23.2059 42.875 23.5234C42.3904 23.8409 41.8727 24 41.3213 24C40.7763 24 40.3323 23.9307 39.9893 23.793C39.789 23.7126 39.7144 23.4828 39.7832 23.2783L40.3926 21.4688C40.4464 21.3096 40.6292 21.24 40.7949 21.2676C40.9118 21.2843 41.0209 21.293 41.1211 21.293C41.522 21.2928 41.931 21.1 42.3486 20.7158C42.7664 20.3315 43.1848 19.7136 43.6025 18.8613L41.3535 6.89746C41.2981 6.6013 41.5248 6.3273 41.8262 6.32715H44.3496ZM32.9072 0C33.1746 4.93046e-06 33.4754 0.0163859 33.8096 0.0498047C34.1604 0.0665113 34.5028 0.108972 34.8369 0.175781C35.171 0.225891 35.4971 0.292475 35.8145 0.375977C36.1319 0.459511 36.4164 0.55982 36.667 0.676758L35.9404 2.95801C35.5561 2.8076 35.1628 2.70736 34.7617 2.65723C34.3608 2.60713 33.9682 2.58203 33.584 2.58203C33.0492 2.58203 32.6559 2.74107 32.4053 3.05859C32.1715 3.37612 32.0045 3.86901 31.9043 4.53711L31.7539 5.36426H33.6768C33.9794 5.36426 34.207 5.64038 34.1494 5.9375L33.835 7.55664C33.791 7.78295 33.5928 7.94629 33.3623 7.94629H31.3525L29.498 18.75C29.3978 19.3683 29.2561 19.937 29.0723 20.4551C28.8884 20.9899 28.6292 21.4496 28.2949 21.834C27.9774 22.235 27.5677 22.5445 27.0664 22.7617C26.5651 22.9956 25.9462 23.1123 25.2109 23.1123C24.6096 23.1123 24.025 23.0621 23.457 22.9619C23.0167 22.899 22.623 22.7791 22.2773 22.6025C22.0801 22.5015 22.0076 22.2643 22.085 22.0566L22.6309 20.5957C22.7261 20.3408 23.0132 20.2194 23.2773 20.2852C23.404 20.3167 23.5306 20.3396 23.6572 20.3545C23.9413 20.3879 24.3008 20.4053 24.7354 20.4053C25.27 20.4052 25.6798 20.1874 25.9639 19.7529C26.2645 19.3351 26.4903 18.6496 26.6406 17.6973L28.2197 7.94629H27.0596C26.7534 7.94603 26.5249 7.66378 26.5889 7.36426L26.9346 5.74512C26.9821 5.52305 27.1791 5.36426 27.4062 5.36426H28.6201L28.9463 3.68457C29.0632 3.06658 29.2137 2.5321 29.3975 2.08105C29.5813 1.61313 29.8242 1.22854 30.125 0.927734C30.4425 0.610249 30.8185 0.37598 31.2529 0.225586C31.7041 0.0752369 32.2556 0 32.9072 0ZM20.6455 5.97656C21.3306 5.97658 21.9158 6.06815 22.4004 6.25195C22.9016 6.41906 23.3105 6.66205 23.6279 6.97949C23.9455 7.2803 24.1797 7.63115 24.3301 8.03223C24.4804 8.43327 24.5557 8.85938 24.5557 9.31055C24.5557 9.99568 24.3802 10.5972 24.0293 11.1152C23.6784 11.6332 23.1857 12.068 22.5508 12.4189C21.9325 12.7532 21.1797 13.0125 20.2939 13.1963C19.4084 13.3633 18.4393 13.4463 17.3867 13.4463H17.0107C16.8938 13.4296 16.7684 13.4219 16.6348 13.4219C16.6014 13.6221 16.5763 13.8057 16.5596 13.9727C16.5429 14.1231 16.5342 14.2657 16.5342 14.3994C16.5342 15.1513 16.726 15.7115 17.1104 16.0791C17.5114 16.4467 18.0716 16.6298 18.79 16.6299C19.5253 16.6299 20.1857 16.5219 20.7705 16.3047C21.3554 16.0874 21.7988 15.8696 22.0996 15.6523L22.751 17.6582C22.2329 18.0927 21.5639 18.46 20.7451 18.7607C19.9263 19.0615 18.9738 19.2119 17.8877 19.2119C16.5343 19.2119 15.4651 18.8194 14.6797 18.0342C13.911 17.2321 13.5264 16.1206 13.5264 14.7002C13.5264 13.3633 13.7346 12.1594 14.1523 11.0898C14.5701 10.0037 15.1138 9.08497 15.7822 8.33301C16.4674 7.58098 17.2366 7.00459 18.0889 6.60352C18.9411 6.18581 19.7933 5.97656 20.6455 5.97656ZM39.9404 1.31348C40.2465 1.31353 40.4746 1.59608 40.4111 1.89551L37.6016 15.1514C37.5013 15.6359 37.5013 15.9956 37.6016 16.2295C37.7186 16.4633 37.9027 16.5801 38.1533 16.5801C38.3573 16.5801 38.5565 16.5623 38.751 16.5273C39.1 16.4646 39.4678 16.715 39.4561 17.0693L39.415 18.2764C39.4095 18.4381 39.3245 18.589 39.1777 18.6572C38.8989 18.7868 38.5407 18.8963 38.1035 18.9863C37.5354 19.1033 36.9752 19.1621 36.4238 19.1621C35.7054 19.1621 35.1539 19.028 34.7695 18.7607C34.4019 18.4767 34.2178 17.9589 34.2178 17.207C34.2178 16.8227 34.2679 16.3793 34.3682 15.8779L37.3701 1.69531C37.4174 1.47292 37.6144 1.31348 37.8418 1.31348H39.9404ZM67.5635 2C67.8074 2.00005 68.016 2.17644 68.0566 2.41699L70.7432 18.3164C70.7947 18.6215 70.5594 18.9004 70.25 18.9004H67.9414C67.6948 18.9002 67.4847 18.7194 67.4473 18.4756L67.0186 15.6846H60.7441L59.3301 18.6172C59.2467 18.7899 59.0717 18.9002 58.8799 18.9004H56.6963C56.3248 18.9004 56.0823 18.5092 56.248 18.1768L64.1816 2.27637C64.2663 2.107 64.4396 2.00008 64.6289 2H67.5635ZM77.2988 2.02441C77.6073 2.02441 77.8419 2.30111 77.792 2.60547L75.1904 18.4805C75.1508 18.7221 74.9421 18.9003 74.6973 18.9004H72.54C72.2314 18.9004 71.9965 18.6229 72.0469 18.3184L74.6699 2.44336C74.7098 2.20195 74.9194 2.02441 75.1641 2.02441H77.2988ZM8.20996 1.06348C8.9786 1.06348 9.70552 1.15508 10.3906 1.33887C11.0758 1.5227 11.6695 1.80704 12.1709 2.19141C12.6721 2.55904 13.0646 3.04397 13.3486 3.64551C13.6494 4.23033 13.7998 4.9236 13.7998 5.72559C13.7998 6.64453 13.658 7.44676 13.374 8.13184C13.1066 8.8003 12.7471 9.36899 12.2959 9.83691C11.8448 10.288 11.327 10.6477 10.7422 10.915C10.1741 11.1657 9.58884 11.3324 8.9873 11.416L12.084 18.1797C12.2296 18.4984 11.9969 18.8611 11.6465 18.8613H9.12793C8.9235 18.8613 8.74152 18.732 8.67383 18.5391L6.37988 11.9932L4.65039 11.667L3.22656 18.4785C3.17981 18.7015 2.98274 18.8613 2.75488 18.8613H0.482422C0.176283 18.8613 -0.0527829 18.5788 0.0107422 18.2793L3.50586 1.80371C3.54621 1.61349 3.69707 1.46583 3.88867 1.43262C4.58747 1.31147 5.2925 1.22116 6.00391 1.16309C6.82277 1.09624 7.55821 1.06348 8.20996 1.06348ZM65.6387 6.83984C65.593 6.54947 65.2003 6.4913 65.0723 6.75586L62.0264 13.0488H66.6133L65.6387 6.83984ZM20.1943 8.4834C19.459 8.4834 18.8152 8.76774 18.2637 9.33594C17.7291 9.90397 17.3366 10.6139 17.0859 11.4658C17.5537 11.4658 18.0466 11.4494 18.5645 11.416C19.0992 11.3826 19.5927 11.3074 20.0439 11.1904C20.495 11.0567 20.8711 10.8726 21.1719 10.6387C21.4724 10.3881 21.623 10.0542 21.623 9.63672C21.623 9.38606 21.5305 9.13542 21.3467 8.88477C21.1629 8.61742 20.7791 8.48344 20.1943 8.4834ZM7.93457 4.12109C7.60034 4.12109 7.28225 4.13845 6.98145 4.17188C6.69751 4.18858 6.45534 4.21367 6.25488 4.24707L5.15137 9.33594H6.48047C6.96506 9.33593 7.4413 9.29351 7.90918 9.20996C8.37708 9.10969 8.78676 8.94294 9.1377 8.70898C9.50523 8.45837 9.79743 8.13238 10.0146 7.73145C10.2486 7.33038 10.3662 6.82046 10.3662 6.20215C10.3662 5.63395 10.1734 5.14913 9.78906 4.74805C9.40473 4.33042 8.78658 4.12115 7.93457 4.12109Z"
            fill={fillColor ?? 'var(--refly-bg-dark, #ECECEC)'}
            opacity={opacity}
          />
        </svg>
      )}
    </div>
  );
};
